{template "header.html", "/"}
<script type="text/javascript" src="{HOME_THEME_PATH}shop/js/mzp-packed.js"></script>
<link rel="stylesheet" href="{HOME_THEME_PATH}shop/css/zzsc.css">
<link rel="stylesheet" href="{HOME_THEME_PATH}shop/css/magiczoomplus.css">
<script language="javascript">
    // 这是加入收藏夹的ajax请求，我就随意写了一下提示信息，至于美化啊什么交给你们了
    function dr_favorite() {
        $.get("/index.php?s={MOD_DIR}&c=api&m=favorite&id={$id}", function(data){
            if (data == 1) {
                dr_tips("没有登录，不能收藏");
            } else if (data == 2) {
                dr_tips("商品不存在，无法收藏");
            } else if (data == 3) {
                dr_tips("更新收藏成功", 3, 1);
            } else if (data == 4) {
                dr_tips("收藏成功", 3, 1);
            }
        });
    }


    // 购物车
    var is_cart = true;
    function dr_cart() {
        if (!is_cart) {
            alert('刷新后再试');
            return;
        }
        var num = $("#touchspin_6").attr("value");

        var cart = "{dr_url('order/cart/add', array('mid'=>MOD_DIR, 'cid'=>$id))}&num="+num;
        is_cart = false;
        $.ajax({type: "GET", url: cart, dataType:"jsonp",
            success: function (data) {
                if (data.status) {
                    var html = "<div style=\"font-size:14px\">已成功添加到购物车！购物车里已有 <font color=red>"+data.code+"</font> 种商品</div>";
                    art.dialog({
                        id: 'cart',
                        lock: true,
                        opacity: 0.1,
                        content: html,
                        ok: function () {
                            location.href="{dr_url('order/cart/index')}";
                            is_cart = true;
                            return false;
                        },
                        okVal: '去结算',
                        cancelVal: '继续购物',
                        cancel: function () {
                            is_cart = true;
                            return true;
                        }
                    });
                } else {
                    dr_tips(data.code);
                    is_cart = true;
                }
            }
        });
    }

    $(window).ready(
            function () {
                var show =  $("#showArea");

                var left = 0;

                var picBox = $(".smallPic");

                var bigPic = $("#main_img");

                var img = $("#showArea img");

                var speed = img.width()*4;

                show.css("width",((img.length+1)*img.width()).toString()+"px");
                img.hover(
                        function () {
                            bigPic.attr("src",this.src);
                            $(".MagicZoomBigImageCont img").attr("src",this.src);
                            $(".MagicThumb-container img").attr("href",this.src);
                            $("#zoom1").attr("href",this.src);
                        }
                );



                $("#gobottom").click(
                        function () {
                            if (parseInt(show.css("left"))-speed <= (-(show.width() - picBox.width()+speed))) {
                                return 0;
                            }
                            show.animate({
                                "left" : left -= speed
                            },200)
                        }
                );
                $("#gotop").click(
                        function () {
                            if (show.css("left") >= "0px") {
                                return 0;
                            }
                            show.animate({
                                "left": left += speed
                            }, 200)

                        }
                );

            }

    );

    function add(id){
        var input = $(id);
        var v = input.attr("value");
        input.attr("value",++v);
    }

    function reduce(id){
        var input = $(id);
        var v = input.attr("value");
        if (v > 1) {
            input.attr("value", --v);
        }
    }



</script>

<div class="page-container">
    <div class="page-content-wrapper">
        {template "header.html"}
        <div class="page-content">
            <div class="container">

                <ul class="page-breadcrumb breadcrumb">
                    <li>
                        <a href="{SITE_URL}">首页</a>
                        <i class="fa fa-circle"></i>
                    </li>
                    {if !IS_SHARE}
                    <li>
                        <a href="{MODULE_URL}">{MODULE_NAME}</a>
                        <i class="fa fa-circle"></i>
                    </li>
                    {/if}
                    {dr_catpos($catid, '', true, '<li><a href="{url}">{name}</a><i class="fa fa-circle"></i></li>')}
                    <li>
                        <span>{$title}</span>
                    </li>
                </ul>

                <div class="page-content-inner">
                    <div class="search-page search-content-2">
                        <div class="row">
                            <div class="col-lg-12">
                                <div class="portlet light">
                                    <div class="row">
                                        <div class="col-md-4">
                                            {if IS_PC}
                                            <div class="left-pro">
                                                <div class="t2">
                                                    <a href="{dr_get_file($duotu[0])}" id="zoom1" class="MagicZoom"><img width="320" height="300" src="{dr_thumb($duotu[0],'320','320')}" id="main_img" class="main_img" width="100%"/></a>
                                                </div>
                                                <div class="t1">
                                                    <img src="{HOME_THEME_PATH}shop/images/left.gif" id="gotop" />
                                                    <div class="smallPic">
                                                        <div id="showArea">
                                                            {loop $duotu $pic}
                                                            <a href="{dr_get_file($pic)}" rel="zoom1" rev="{dr_get_file($pic)}">
                                                                <img src="{dr_get_file($pic)}" width="320" height="300">
                                                            </a>
                                                            {/loop}
                                                        </div>
                                                    </div>
                                                    <img src="{HOME_THEME_PATH}shop/images/right.gif" onclick="" id="gobottom"/>
                                                </div>
                                            </div>
                                            {else}

                                            {/if}


                                        </div>
                                        <div class="col-md-8">
                                            <div class="portlet light" style="padding-top:0px;margin-bottom:0;padding-left: 0px;">
                                                <div class="portlet-title">
                                                    <div class="caption">
                                                        <span class="caption-subject font-dark bold uppercase">{$title}</span>
                                                    </div>
                                                </div>
                                                <div class="search-post-foot" style="padding-top:0px;text-align:left;padding-bottom: 10px">
                                                    <div class="search-post-meta">
                                                        <i class="icon-user font-blue"></i>
                                                        <a href="javascript:;">{$author}</a>
                                                    </div>
                                                    <div class="search-post-meta">
                                                        <i class="icon-calendar font-blue"></i>
                                                        <a href="javascript:;">{$updatetime}</a>
                                                    </div>
                                                    <div class="search-post-meta">
                                                        <i class="icon-fire font-blue"></i>
                                                        <a href="javascript:;">{dr_show_hits($id)}次</a>
                                                    </div>
                                                    <div class="search-post-meta">
                                                        <i class="icon-bubble font-blue"></i>
                                                        <a href="javascript:;">{$comments}</a>
                                                    </div>
                                                    <div class="search-post-meta">
                                                        <i class="icon-flag font-blue"></i>
                                                        <a href="javascript:dr_favorite();">加入收藏</a>
                                                    </div>
                                                </div>

                                                <form action="{SITE_URL}" method="get" class="form-horizontal" novalidate="novalidate">
                                                    <input type="hidden" name="s" value="order">
                                                    <input type="hidden" name="c" value="home">
                                                    <input type="hidden" name="m" value="index">
                                                    <input type="hidden" name="mid" value="{MOD_DIR}">
                                                    <input type="hidden" name="cid" value="{$id}">
                                                    <div class="form-body" style="padding-top:10px;">
                                                        <div class="form-group">
                                                            <label class="col-md-2 control-label"><strong>地区：</strong></label>
                                                            <div class="col-md-10"><div class="form-control-static "><i class="fa fa-truck"></i>&nbsp;{dr_linkagepos('address', $area, ' > ', dr_search_url($params, 'area', '{linkage}'))}</div></div>
                                                        </div> <div class="form-group">
                                                            <label class="col-md-2 control-label"><strong>价格：</strong></label>
                                                            <div class="col-md-10"><div class="form-control-static "><i class="fa fa-cny"></i>&nbsp;{$order_price}</div></div>
                                                        </div>
                                                        <div class="form-group">
                                                            <label class="col-md-2 control-label"><strong>剩余：</strong></label>
                                                            <div class="col-md-10"><div class="form-control-static "><i class="fa fa-hourglass-end"></i>&nbsp;{$order_quantity}</div></div>
                                                        </div>
                                                        <div class="form-group">
                                                            <label class="col-md-2 control-label"><strong>已售：</strong></label>
                                                            <div class="col-md-10"><div class="form-control-static "><i class="fa fa-shopping-cart"></i>&nbsp;{$order_volume}</div></div>
                                                        </div>
                                                        <div class="form-group">
                                                            <label class="col-md-2 control-label" for="touchspin_6"><strong>购买数量：</strong></label>
                                                            <div class="col-md-4">
                                                                <div class="input-group bootstrap-touchspin">
                                                                    <span class="input-group-btn">
                                                                        <button class="btn btn-default bootstrap-touchspin-down" onclick="reduce('#touchspin_6')" type="button">-</button>
                                                                    </span><span class="input-group-addon bootstrap-touchspin-prefix" style="display: none;"></span>
                                                                    <input id="touchspin_6" type="text" value="1" name="num" class="form-control" style="display: block;">
                                                                    <span class="input-group-addon bootstrap-touchspin-postfix" style="display: none;"></span>
                                                                    <span class="input-group-btn">
                                                                        <button class="btn btn-default bootstrap-touchspin-up" onclick="add('#touchspin_6')" type="button">+</button>
                                                                    </span>
                                                                </div>

                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="form-body">
                                                        <div class="form-group">
                                                            <div class=" col-md-offset-2 col-md-8">
                                                                <button type="submit" class="mysubmit btn green"><i class="fa fa-check"></i> 立即购买</button>
                                                                <a class="btn btn-default" href="javascript:;" onclick="dr_cart()"><i class="fa fa-cart-plus"></i>&nbsp;加入购物车</a>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </form>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>



                        <div class="row">
                            <div class="col-md-12">
                                <div class="portlet light">
                                    <div class="portlet-body" style="height: auto;">
                                        {$content}
                                    </div>

                                    <div class="blog-single-foot">

                                        <ul class="blog-post-tags" style="margin-top: 20px;">
                                            {loop $keyword_list $name $url}
                                            <li class="uppercase">
                                                <a href="{$url}" target="_blank">{$name}</a>
                                            </li>
                                            {/loop}
                                        </ul>
                                        <p class="f14" style="margin-bottom: 0">
                                            <strong>上一篇：</strong>{if $prev_page}<a href="{$prev_page.url}">{$prev_page.title}</a>{else}没有了{/if}<br>
                                            <strong>下一篇：</strong>{if $next_page}<a href="{$next_page.url}">{$next_page.title}</a>{else}没有了{/if}
                                        </p>
                                    </div>

                                    {dr_module_comment(MOD_DIR, $id)}

                                </div>


                            </div>
                        </div>
                    </div>


                </div>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript" src="{HOME_THEME_PATH}shop/js/zzsc.js"></script>
<script type="text/javascript" src="{HOME_THEME_PATH}photo/src/js/hammer.min.js"></script>
<script type="text/javascript" language="javascript" src="{HOME_THEME_PATH}photo/lib/FlameViewportScale.js"></script>
<script type="text/javascript" language="javascript" src="{HOME_THEME_PATH}photo/src/js/jquery.tosrus.min.all.js"></script>
<link type="text/css" media="all" rel="stylesheet" href="{HOME_THEME_PATH}photo/src/css/jquery.tosrus.all.css" />
<script type="text/javascript" language="javascript">
    jQuery(function($) {
        $('#myphoto a').tosrus({
            pagination: {
                add: true
            },
            caption: {
                add: true
            },
            slides: {
                scale: 'fill'
            }
        });

    });
</script>

{template "footer.html", "/"}